package calculator.controller;/*
 * @author     ：zhangbo
 * @date       ：Created in 2021/5/22 12:05
 * @description：负责处理用户单击运算符按钮触发的ActionEvent事件。
 * @modified By：zhangbo
 * @version:     $
 */

import calculator.model.Computer;
import calculator.model.MathComputer;
import calculator.view.CalculatorWindows;

import javax.swing.*;
import java.awt.event.ActionEvent;

public class HandleOperator extends HandleEvent {
    public HandleOperator(CalculatorWindows window) {
        super(window);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        JButton b = (JButton) e.getSource();
        String buttonName = b.getText().trim();
        char operator = buttonName.charAt(0);
        window.computer.setOperator(operator);
        window.showOperator.setText(buttonName);
    }
}
